package com.itheima.day13.thread.test7;

import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;

public class Test {
    public static void main(String[] args) {
        MyCallable mc1 = new MyCallable();
        FutureTask<String> ft1 = new FutureTask<>(mc1);
        Thread t1 = new Thread(ft1);
        // System.out.println(t1.getPriority());
        t1.setName("舒克");
        t1.setPriority(10);
        t1.start();

        Thread t2 = new Thread(new FutureTask<String>(new Callable<String>() {
            @Override
            public String call() throws Exception {
                for (int i = 0; i < 50; i++) {
                    System.out.println(Thread.currentThread().getName() + "---" + i);
                }
                return Thread.currentThread().getName() + "线程执行完毕了";
            }
        }));
        t2.setName("贝塔");
        t1.setPriority(1);
        t2.start();

    }
}
